@import "../lib/table.css";
@import "../lib/journal.css";
@import "./system-global.scss";

#journal {
    grid-template-rows: auto 1fr;

    .cockpit-log-panel {
        border: none;
    }

    .pf-c-page__main {
        // Constrain page to viewport height, so journal can overflow
        max-height: 100vh;
    }
}

#journal-entry {
    .pf-l-gallery {
        --pf-l-gallery--GridTemplateColumns: 1fr;
    }

    .pf-c-page__main-breadcrumb {
        padding: var(--pf-global--gutter);
    }

    /* Do not break labels */
    .info-table-ct td:first-child {
        word-break: keep-all;
    }

    .pf-c-card__title,
    .multiline,
    .info-table-ct td:not(:first-child) {
        word-break: break-all;
        white-space: pre-wrap !important;
        font-family: monospace, monospace;
    }

    .pf-l-split {
        padding-bottom: var(--pf-global--gutter);
        align-items: center;
    }

    .info-table-ct > thead > tr > th {
        padding-left: 1rem;
    }
}

#journal .filter select,
#journal .filter button,
#journal .filter input {
    margin-right: var(--pf-global--spacer--md);
}

#journal-box {
    flex: auto;
    
    .panel-heading {
        position: sticky;
        top: 0;
        color: var(--pf-global--Color--300);
        background-color: var(--pf-global--BackgroundColor--100);
        border: none;
        font-size: var(--pf-global--FontSize--md);
        font-family: var(--pf-global--FontFamily--heading--sans-serif);
        font-weight: var(--pf-global--FontWeight--semi-bold);
        padding: var(--pf-global--spacer--lg) var(--pf-global--spacer--lg) var(--pf-global--spacer--sm);
    }
}

/* Set min width for services in the journal view */
#journal .cockpit-logline {
    --log-service-min: 8rem;
}

.filter {
    position: relative;
    display: flex;
    align-items: baseline;
    align-self: flex-end;
    flex-direction: row;
    margin: 1rem 0 0;
    text-align: right;

    > label {
        display: block;
        margin-right: var(--pf-global--spacer--md);
    }
}

@media (max-width: 1300px) {
    .filter {
        // Switch label to row in certain screen sizes
        flex-direction: column;
        text-align: left;
    }
}
@media (min-width: 561px) {
    .filters-toggle {
        display: none;
    }

    .cockpit-logline {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (max-width: 560px) {
    .filter {
        // Switch label to row in certain screen sizes
        flex-direction: row;

        > label {
            min-width: 4em;
        }
    }

    .filter-separator {
        display: none;
    }

    .content-header-extra {
        flex-wrap: wrap;

        &.toggle-filters-closed .filter {
            display: none;
        }
    }
}

.content-header-extra + #journal-box {
    margin: 0;
    padding: 0;
    overflow: auto;
}

.content-header-extra {
    display: flex;
    align-items: flex-end;
    padding: 0 var(--pf-global--spacer--lg) var(--pf-global--spacer--md);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    flex: auto;
}

.filters-toggle {
    > .pf-c-button.pf-m-link {
        padding: 1rem 0;
        padding: var(--pf-global--spacer--form-element) 0;
    }
}

.filter-group {
    width: 100%;
    display: flex;
    flex-grow: 1;
    flex-wrap: nowrap;
    align-items: baseline;
}

.filter-actions {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    flex-shrink: 0;
    margin: var(--pf-global--spacer--md) 0 0;

    > :not(:first-child) {
        margin-left: var(--pf-global--spacer--md);
    }
}

// Simulate a pf-c-data-toolbar__item.pf-m-separator
// (as PF4 isn't used in the page currently)
.filter-separator {
    height: var(--pf-global--FontSize--lg);
    width: var(--pf-global--BorderWidth--md);
    background-color: var(--pf-global--BorderColor--100);
    // margin may still be needed when swapping out for the PF4 widget
    margin: var(--pf-global--spacer--sm) var(--pf-global--spacer--md);
    align-self: flex-end;
}

#journal-service-menu {
    width: 8em; // Static width as it likes to resize a lot while loading
}

.filters-toggle {
    flex-grow: 1;
}

.filters-toggle button {
    white-space: nowrap;
}

.filter.text-search {
    min-width: 8em;
    flex-grow: 1;
}

#accordion-markup {
    margin-bottom: 0px;
}

.dropdown-toggle:active,
.dropdown-toggle:hover,
.dropdown-toggle:focus,
.dropdown.open .dropdown-toggle {
    color: var(--pf-global--link--Color) !important;
}

.dropdown-menu {
    left: auto;
    margin: 0;
}

#logs-help-menu {
    left: auto;
    right: -1rem;
    padding: 1rem;

    ul {
        list-style: initial;
        padding-left: 1rem;
    }

    .help-links {
        display: flex;
        justify-content: space-between;

        > a {
            padding: 0.2rem 0;
            display: block;

            i {
                padding-left: 0.2rem;
            }
        }
    }

    .journal-cmd {
        display: flex;
        flex-wrap: nowrap;

        > pre {
            padding-left: 0.2rem;
            width: 100%;
            max-width: 26rem;
        }

        > button {
            border-radius: 0;
            border: 1px solid #ccc;
            border-left: 0;
        }
    }
}

.green-icon {
    color: var(--pf-global--success-color--100);
}
